home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Today - The Disc! 5
/
CD-ROM Today - The Disc (Issue 5)(November 1994).ISO
/
mac
/
Mac shareware
/
Education
/
RLaB
/
examples
/
sfft.r
< prev
next >
Wrap
Text File
|
1994-09-21
|
357b
|
26 lines
//
// Calculate Fourier transform of a finite signal (SLOWLY)
//
sfft = function ( x )
{
local(i, k, n, X);
if(class (x) != "num")
{
error ("input to sfft must be a matrix");
}
X = zeros ( size (x) );
for( k in 1:x.n )
{
for( n in 1:x.n )
{
X[k] = X[k] + x[n]*exp( (-1i*2*pi*(k-1)*(n-1))/x.n );
}
}
return X;
}